//
//  SubTitleItem.m
//  CareRingApp
//
//  Created by Linktop on 2024/4/9.
//

#import "SubTitleItem.h"
#import <QMUIKit/QMUIKit.h>
#import <Masonry/Masonry.h>
#import "ConfigModel.h"
@implementation SubTitleItem

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)init
{
    self = [super init];
    if (self) {
        
        
        [self addSubview:self.mainTitleLbl];
        [self addSubview:self.subTitleLbl];
        
        [self.mainTitleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(3);
            make.leading.trailing.equalTo(self);
            make.height.equalTo(self.subTitleLbl);
        }];
        [self.subTitleLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.leading.trailing.equalTo(self);
            make.bottom.equalTo(self.mas_bottom).inset(3);
            make.top.equalTo(self.mainTitleLbl.mas_bottom);
        }];
        [self addSubview:self.sepLine];
        self.sepLineHorMArgin = 0;
       
        
    }
    return self;
}

-(void)setSepLineHorMArgin:(CGFloat)sepLineHorMArgin
{
    _sepLineHorMArgin = sepLineHorMArgin;
    [self.sepLine mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@0.5);
        make.bottom.equalTo(self.mas_bottom);
        make.leading.equalTo(self.mas_leading).offset(_sepLineHorMArgin);
        make.trailing.equalTo(self.mas_trailing).inset(_sepLineHorMArgin);

    }];
}

-(UILabel *)mainTitleLbl
{
    if (!_mainTitleLbl) {
        _mainTitleLbl = [UILabel new];
        _mainTitleLbl.textColor = UIColor.lightGrayColor;
        _mainTitleLbl.font = [UIFont systemFontOfSize:15];
    }
    return _mainTitleLbl;
}

-(UILabel *)subTitleLbl
{
    if (!_subTitleLbl) {
        _subTitleLbl = [UILabel new];
        _subTitleLbl.font = [UIFont systemFontOfSize:15];
    }
    return _subTitleLbl;
}

-(UIView *)sepLine
{
    if (!_sepLine) {
        _sepLine = [UIView new];
        _sepLine.backgroundColor = SEPLINE_COLOR(1);
    }
    return _sepLine;
}
@end
